package org.wmq.skyserver.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wmq.skycommon.pojo.DTO.UserLoginDTO;
import org.wmq.skycommon.pojo.entity.User;
import org.wmq.skyserver.mapper.UserMapper;
import org.wmq.skyserver.service.UserService;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public User wxLogin(UserLoginDTO loginDTO) {
        User user = this.userMapper.getByOpenid(loginDTO.getCode());
        if (user == null) {
            user = new User();
            userMapper.insert(user);
        }
        return user;
    }
}
